# 自由课题, 大家按自己的想法, 将身边的事物抽象出一个类, 并创建多个实例
class Animal(object):
    subject='animal'
    def __init__(self,obj):
        self.p=obj

    def show_type(self):
        print("i am animal")

print(Animal)  #<class '__main__.Animal'>

ani = Animal("anima1")
print(ani)  #<__main__.Animal object at 0x000002419E826400>
print(ani.p)

ani2 = Animal("anima2")
print(ani2)  #<__main__.Animal object at 0x000002419E826400>
print(ani2.p)


class Dog(Animal):
    def __init__(self,name,calls):
        self.name=name
        self.calls = calls
    def displayCall(self):
        print("my calls is:", self.calls)


class Cat(Animal):
    def __init__(self,name,calls):
        self.name=name
        self.calls = calls
    def displayCall(self):
        print("my calls is:" ,self.calls)

dog=Dog("dog","wangwang")
cat=Cat("cat","miaomiao")
print(dog.name)
print(cat.name)
dog.displayCall()
cat.displayCall()
dog.show_type()

